package com.freesky.biz.icbc.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

@Data
public class TreeCategorySelect implements Serializable {
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private String id;

    /** 节点名称 */
    private String label;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeCategorySelect> children;

    public TreeCategorySelect()
    {

    }

    public TreeCategorySelect(TAigouCategory aigouCategory)
    {
        this.id = aigouCategory.getCategoryId();
        this.label = aigouCategory.getCategoryName();
        this.children = aigouCategory.getChildren().stream().map(TreeCategorySelect::new).collect(Collectors.toList());
    }
}
